﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Common.Utilities.DLR;

namespace Workflows.Components.Monitor
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    [OrmClass("WfRunLog","WfRunLogID",true)]
    public class WfRunLog
    {
        private int _WfRunLogID;
        /// <summary></summary>
        [OrmField("WfRunLogID",SqlDbType.Int,4,OrmFieldSerializationMethod.DefaultSerialization)]
        public int WfRunLogID
        {
            get
            {
                return this._WfRunLogID;
            }
            set
            {
                this._WfRunLogID = value;
            }
        }

        private Guid _RunID;
        /// <summary></summary>
        [OrmField("RunID",SqlDbType.VarChar,50,OrmFieldSerializationMethod.DefaultSerialization)]
        public Guid RunID
        {
            get
            {
                return this._RunID;
            }
            set
            {
                this._RunID = value;
            }
        }

        private Guid _WfDesignID;
        /// <summary></summary>
        [OrmField("WfDesignID",SqlDbType.VarChar,50,OrmFieldSerializationMethod.DefaultSerialization)]
        public Guid WfDesignID
        {
            get
            {
                return this._WfDesignID;
            }
            set
            {
                this._WfDesignID = value;
            }
        }

        private WfRunLogType _LogType;
        /// <summary></summary>
        [OrmField("LogType",SqlDbType.Int,4,OrmFieldSerializationMethod.DefaultSerialization)]
        public WfRunLogType LogType
        {
            get
            {
                return this._LogType;
            }
            set
            {
                this._LogType = value;
            }
        }

        private DateTime _TimeStamp;
        /// <summary></summary>
        [OrmField("TimeStamp",SqlDbType.DateTime,8,OrmFieldSerializationMethod.DefaultSerialization)]
        public DateTime TimeStamp
        {
            get
            {
                return this._TimeStamp;
            }
            set
            {
                this._TimeStamp = value;
            }
        }

        private string _Person;
        /// <summary></summary>
        [OrmField("Person",SqlDbType.VarChar,100,OrmFieldSerializationMethod.DefaultSerialization)]
        public string Person
        {
            get
            {
                return this._Person;
            }
            set
            {
                this._Person = value;
            }
        }

        private string _Machine;
        /// <summary></summary>
        [OrmField("Machine",SqlDbType.VarChar,100,OrmFieldSerializationMethod.DefaultSerialization)]
        public string Machine
        {
            get
            {
                return this._Machine;
            }
            set
            {
                this._Machine = value;
            }
        }

        private Guid _JobID;
        /// <summary></summary>
        [OrmField("JobID",SqlDbType.VarChar,50,OrmFieldSerializationMethod.DefaultSerialization)]
        public Guid JobID
        {
            get
            {
                return this._JobID;
            }
            set
            {
                this._JobID = value;
            }
        }

        private string _ComponentName;
        /// <summary></summary>
        [OrmField("ComponentName",SqlDbType.VarChar,255,OrmFieldSerializationMethod.DefaultSerialization)]
        public string ComponentName
        {
            get
            {
                return this._ComponentName;
            }
            set
            {
                this._ComponentName = value;
            }
        }

        private string _Message;
        /// <summary></summary>
        [OrmField("Message",SqlDbType.VarChar, 2000,OrmFieldSerializationMethod.DefaultSerialization)]
        public string Message
        {
            get
            {
                return this._Message;
            }
            set
            {
                this._Message = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="runID"></param>
        /// <param name="wfID"></param>
        /// <param name="logType"></param>
        /// <param name="person"></param>
        /// <param name="machine"></param>
        /// <param name="jobID"></param>
        /// <param name="componentName"></param>
        /// <param name="msg"></param>
        public WfRunLog(Guid runID, Guid wfID, WfRunLogType logType,
            string person, string machine, Guid jobID, string componentName, string msg)
        {
            this._WfRunLogID = 0;
            this._RunID = runID;
            this._WfDesignID = wfID;
            this._LogType = logType;
            this._Person = person;
            this.Machine = machine;
            this._JobID = jobID;
            this._ComponentName = componentName;
            this._Message = msg;
            this._TimeStamp = DateTime.Now;
        }
    }
}
